Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use bitfields to enumerate sectors for winning post #2209

Merged
merged 1 commit into from
Jul 1, 2020

Conversation

whyrusleeping
Copy link
Member

This function is currently the most expensive thing showing up in traces, this should help significantly.

Copy link
Contributor

@magik6k magik6k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks faster

(will merge after testing on my node)

@magik6k magik6k merged commit cd34d02 into master Jul 1, 2020
@magik6k magik6k deleted the feat/faster-winpost-sectors branch July 1, 2020 08:43
Copy link
Contributor

@Kubuxu Kubuxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGWM

return nil, xerrors.Errorf("failed to load deadlines: %w", err)
}

notProving, err := abi.BitFieldUnion(mas.Faults, mas.Recoveries)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this isn't necessary. Recoveries is a subset of Faults.

if err != nil {
return nil, xerrors.Errorf("generating winning post challenges: %w", err)
}

sectors, err := provingSectors.All(miner.SectorsMax)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you update go-bitfield, you should be able to do this without expanding the bitset.

iter, err := provingSectors.BitIterator()
...
offset := 0
for i, n := range ids { // assuming the ids are sorted.
    sid, err := iter.Nth(n-offset)
    ...
    offset += n
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants